package com.day10;


import java.util.ArrayList;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MaStream3 {
    public static void main(String[] args) {
        ArrayList<String> al = new ArrayList<>();
        al.add("张三,23");
        al.add("李四,26");
        al.add("王五,25");
        al.add("赵六,24");
        Stream<String> ss = al.stream();

        Map<String, Integer> map = ss.filter(s ->
        {
            String[] split = s.split(",");
            int a = Integer.parseInt(split[1]);
            return a >= 25;
        }).collect(Collectors.toMap((String s) -> {
                    String[] split = s.split(",");
                    return split[0];
                }, (String s) -> {
                    String[] split = s.split(",");
                    int a = Integer.parseInt(split[1]);
                    return a;
                }
        ));
        System.out.println(map);
    }
}
